<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>鼓励金充值</title>
    <script src="__INDEX__/js/mui.min.js"></script>
	<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
	<link rel="stylesheet" href="__INDEX__/css/style.css" />
	<link rel="stylesheet" href="__INDEX__/css/mall.css" />	
	<link rel="stylesheet" href="__INDEX__/css/wallet.css" />
</head>
<body>
	<header class="mui-bar mui-bar-nav glj_bar_nav">
	    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	    <h1 class="mui-title">鼓励金提现</h1>
	</header>	
	<div class="mui-content">
	    <div class="yjzye_top">
	    	<span class="nam">鼓励金</span>
	    	<span class="iconfont icon-jiantou1"></span>
	    	<span class="nam">余额</span>
	    </div>
	    <div class="tixian_pri">
	    	<p>兑现到余额(扣除5%服务费)<br>可兑现鼓励金：<em id='yongj'>{$info_user['score']}</em></p>
	    	<p class="tixian_prinum clearfix">
	    		<label>¥</label>
	    		<input type="text" id="much" placeholder=""/>
	    	</p>
	    </div>
	    <form class="layui-form update_form">
		    <div class="xiey_group">
				<input name="checkbox" id="checkbox" value="Item 1" type="checkbox" >
				<span><a href="xieyi.html?type=tx">鼓励金提现协议</a></span>					
			</div>
		</form>
		<div class="xiey_tip" style="padding-bottom: 0;">
			会员兑现须知：您已确认并同意将鼓励金按1000:100比例兑换成现金，兑现时将扣除5%的服务费。
		</div>
		
		<!-- 支付密码 start-->
		<div class="mask" id='pay_by_score'>
			<div class="mask_con">
				<div class="top">
					<span class="del"><button type="button"  onclick="location.reload()">X</button></span>
					<div>						
						<span class="wz" >请输入操作密码</span>
					</div>
					<span class="wz" style="width: 45%;"><a href="pay_pwd.html" style="float: right;font-size: 14px;color: red;margin-right: 15px;">忘记密码</a></span>
				</div>
				<div class="xfk_btn" id='is_pay_pwd' style="display: none;">
					<button type="button">设置支付密码</button>
				</div>
				<div class="pwd-box" id='pay_pwd' style="none">
					<input type="tel" maxlength="6" class="pwd-input" id="pwd-input">
					<div class="fake-box">
						<input type="password" readonly="">
						<input type="password" readonly="">
						<input type="password" readonly="">
						<input type="password" readonly="">
						<input type="password" readonly="">
						<input type="password" readonly="">
					</div>
				</div>
			</div>
		</div>
		<!-- 支付密码 end-->
		
	    <button class="tixian_btn">确认</button>
	</div>
</body>
{include file="public/footer" /}
<script>
	
	$(function(){
		var is_verify = "{$info_user['is_verify']}";
		if(is_verify != 1){
			layer.msg('请先认证个人信息',function(){
				location.href = "{:url('member/renzhen')}";
			})
		}
	})
	
	
	$(".tixian_btn").click(function(){
		if($('#checkbox').is(':checked')==false) {
				    layer.msg('请阅读充值协议');
				    return;
		}
		$('#pay_by_score').show();
		var $input = $(".fake-box input");  
		$("#pwd-input").on("input", function() {
		    var pwd = $(this).val().trim();  
	        for (var i = 0, len = pwd.length; i < len; i++) {
	            $input.eq("" + i + "").val(pwd[i]);  
	        }  
	        $input.each(function() {
	            var index = $(this).index();  
	            if (index >= len) {  
	                $(this).val("");  
	            }
	        });
	        var much=$("#much").val();
			var no=$("#no").val();
			if(isNaN(much)||much<=0){
				layer.msg("请输入正确兑现金额");
				return;
			}
			if(len == 6){
				$.ajax({
					url: "{:url('member/glj_tixian')}",
					type:'post',
					data: {
							much	: much,
							pwd		: pwd
					},
					success: function(data) {
						layer.msg(data.msg, {
							icon: 1,
							time: 1000
						}, function() {
							window.location.href = "{:url('member/glj')}";
						});
					}
				})
			}
		})
	})
</script>
</html>
